<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>部门管理</title>
    <link rel="stylesheet" th:href="@{/layui1/css/layui.css}" media="all">
    <script th:src="@{/layui1/layui.js}"></script>
    <script th:src="@{/dept/js/dept.js}"></script>
</head>
<body>
<div class="page-wrapper">
    <!--===================================================================保存部门===============================================-->
    <form class="layui-form layui-form-pane" id="save_dept_form" lay-filter="save_dept_form_filter"
          style="display: none;margin: 10px">
        <div class="layui-form-item">
            <input type="hidden" name="parentId" class="parent_id">
            <label class="layui-form-label">上级部门</label>
            <div class="layui-input-inline">
                <input type="text" name="parentName" placeholder="单击选择上级部门"
                       autocomplete="off"
                       class="layui-input parent_name">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门类型</label>
            <div class="layui-input-block">
                <select id="deptType" name="deptType" lay-verify="required" lay-reqText="部门类型不能为空">
                    <option value="A">区级</option>
                    <option value="L">派出所</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门名称</label>
            <div class="layui-input-inline">
                <input type="text" name="deptName" required lay-verify="required" placeholder="请输入部门名称"
                       autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="checkbox" name="status" lay-skin="switch" lay-text="正常|禁用" checked value="0">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">显示排序</label>
            <div class="layui-input-inline">
                <input type="text" name="orderNum" required lay-verify="required" placeholder="请输入显示排序"
                       autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input type="text" name="remark" required lay-verify="required" placeholder="请输入备注信息"
                       autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" align="center">
            <div class="layui-inline">
                <button class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="formSaveDept">
                    <i class="layui-icon layui-icon-release"></i> 立即提交
                </button>
            </div>
            <div class="layui-inline">
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius"><i class="layui-icon layui-icon-refresh"></i>重置
                </button>
            </div>
        </div>
    </form>
    <!--    ==========================编辑部门===================================-->
    <form class="layui-form layui-form-pane" id="update_dept_form" lay-filter="update_dept_form_filter"
          style="display: none;margin: 10px">
        <div class="layui-form-item">
            <input type="hidden" name="parentId" class="parent_id">
            <input type="hidden" name="deptId">
            <label class="layui-form-label">上级部门</label>
            <div class="layui-input-inline">
                <input type="text" name="parentName" placeholder="单击选择上级部门"
                       autocomplete="off"
                       class="layui-input parent_name" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门类型</label>
            <div class="layui-input-block">
                <select name="deptType" lay-verify="required" lay-reqText="部门类型不能为空" disabled>
                    <option value="C">市级</option>
                    <option value="A">区级</option>
                    <option value="L">派出所</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">部门名称</label>
            <div class="layui-input-inline">
                <input type="text" name="deptName" required lay-verify="required" placeholder="请输入部门名称"
                       autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="checkbox" name="status" lay-skin="switch" lay-text="正常|禁用" checked value="0">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">显示排序</label>
            <div class="layui-input-inline">
                <input type="text" name="orderNum" required lay-verify="required" placeholder="请输入显示排序"
                       autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input type="text" name="remark" required lay-verify="required" placeholder="请输入备注信息"
                       autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" align="center">
            <div class="layui-inline">
                <button class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="formUpdateDept">
                    <i class="layui-icon layui-icon-release"></i> 立即提交
                </button>
            </div>
            <div class="layui-inline">
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius"><i class="layui-icon layui-icon-refresh"></i>重置
                </button>
            </div>
        </div>
    </form>

    <div class="demo-side">
        <table id="deptTreeTb"></table>
    </div>

    <div class="layui-form-item" id="choose_parent_dept" style="display: none">
        <label class="layui-form-label">所属上级</label>
        <div class="layui-input-inline">
            <div id="deptTreeChoose" class="demo-tree-more"></div>
        </div>
    </div>

</div>

<!--==================================================================以下是模板==================================================-->
<!-- 表格操作列 -->
<script type="text/html" id="tbBar">
    <a class="layui-btn layui-btn-radius" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-radius" lay-event="del">删除</a>
</script>
<!-- 顶部工具栏-->
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="addDept"><i class="layui-icon">&#xe608;</i> 添加部门</button>
        <button id="btnExpandAll" class="layui-btn layui-btn-sm layui-btn-primary">
            <i class="layui-icon">&#xe668;</i>展开全部
        </button>
        <button id="btnFoldAll" class="layui-btn layui-btn-sm layui-btn-primary">
            <i class="layui-icon">&#xe66b;</i>折叠全部
        </button>
    </div>
</script>
</body>
</html>